//
// Created by Administrator on 2021/11/27.
//
#include "string"
#include <iostream>
#include "iomanip"
using namespace std;
class MemberType
{
public:
    MemberType(): firstName(""), lastName(""), membershipNumber(0) {}
    MemberType(const string &firstName, const string &lastName, int membershipNumber):
            firstName(firstName), lastName(lastName), membershipNumber(membershipNumber) {}
    void setMemberInfo(const string &firstName, const string &lastName, int membershipNumber){
        this->firstName = firstName;
        this->lastName = lastName;
        this->membershipNumber = membershipNumber;
    }
    string getFirstName() const {
        return firstName;
    }
    string getLastName() const {
        return lastName;
    }
    int getMembershipNo() const {
        return membershipNumber;
    }
    void printName() const {
        cout << this->lastName << ", " << this->firstName << endl;
    }
    void printMemberInfo() const {
        cout << this->membershipNumber << " - " << this->firstName << " " << this->lastName << endl;
    }
    ~MemberType() {}
private:
    string firstName;
    string lastName;
    int membershipNumber;
};

class DonorType: public MemberType {
public:
    DonorType() : donationAmount(0) {}
    DonorType(const string &firstName, const string &lastName, int membershipNumber, double donationAmount)
            : MemberType(firstName, lastName, membershipNumber) {
        this->donationAmount = donationAmount;
    }
    void setDonorInfo(const string &firstName, const string &lastName, int membershipNumber, double donationAmount) {
        this->setMemberInfo(firstName, lastName, membershipNumber);
        this->donationAmount = donationAmount;
    }
    void setAmountDonated(double donationAmount) {
        this->donationAmount = donationAmount;
    }
    double getAmountDonated() const {
        return donationAmount;
    }
    void printDonor() const {
        this->printMemberInfo();
    }
    void printDonation() const {
        cout << setiosflags(ios::fixed);
        cout << this->getLastName() << " " << this->getFirstName() << endl
             << "    Donation amount: $" << setprecision(2) << this->donationAmount << endl;
    }
    ~DonorType() {}
private:
    double donationAmount;
};

int main()
{
    MemberType biden("Joe", "Biden", 46);
    MemberType trump;
    cout << "trump's membershipNumber is: " << trump.getMembershipNo() << endl;
    trump.setMemberInfo("Donald", "Trump", 45);

    cout << "biden's firstName is: " << biden.getFirstName() << endl;
    cout << "biden's lastName is: " << biden.getLastName() << endl;
    cout << "biden's membershipNumber is: " << biden.getMembershipNo() << endl;
    cout << "trump's name is: " << endl;
    trump.printName();
    cout << "trump's information is:" << endl;
    trump.printMemberInfo();

    DonorType bidenFans("Joe", "Biden", 46, 100.1234);
    DonorType trumpFans;
    cout << "another fans' amountDonated is: " << trumpFans.getAmountDonated() << endl;
    trumpFans.setDonorInfo("Donald", "Trump", 45, 150.6789);

    bidenFans.setAmountDonated(200.7777);
    cout << "bidenFans' amountDonated is: " << bidenFans.getAmountDonated() << endl;
    bidenFans.printDonation();
    trumpFans.printDonor();
}

